package com.hrc.springboot.mapper;

import com.hrc.springboot.bean.Department;
import org.apache.ibatis.annotations.*;

//@Mapper // 声明当前是Mybatis操作数据库的接口
public interface DepartmentMapper {
    @Select("SELECT * FROM department WHERE id = #{id}")
    Department getDepartmentById(@Param("id") Integer id);

    @Delete("DELETE FROM department WHERE id = #{id}")
    int deleteDeptById(@Param("id") Integer id);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("INSERT INTO department(department_name) VALUES(#{department_name})")
    int insertDept(Department department);

    @Update("UPDATE department SET departmentName=#{department_name} WHERE id = #{id}")
    int updateDept(Department department);
}
